package cn.stylefeng.guns.sms.core.enums;

/**
 * 短信发送模板id
 *
 * @author jwj
 * @Date 2019年5月6日 12:30:48
 */
public enum SmsTemplateCode {

    REG(1, "GUNS_SMS_TEMPLATE_CODE_REG"),

    LOGIN(2, "GUNS_SMS_TEMPLATE_CODE_LOGIN"),

    CHANGE(3, "GUNS_SMS_TEMPLATE_CODE_CHANGE");

    private Integer code;

    private String desc;

    SmsTemplateCode(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 通过code获取键值
     * @param code
     * @return
     */
    public static String getDescByCode(Integer code){
        if (code == null) {
            return null;
        } else {
            for (SmsTemplateCode item : SmsTemplateCode.values()) {
                if (item.getCode().equals(code)) {
                    return item.getDesc();
                }
            }
            return null;
        }
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
